package com.practice.J2E.Test;

import java.sql.*;

/**
 * @author kayn
 * @create 2023-09-14 下午 03:26
 */
public class JdbcTest {

    public static void main(String[] args) throws Exception {

        Class.forName("com.mysql.cj.jdbc.Driver");

        Connection connection = DriverManager.getConnection("jdbc:mysql://121.37.108.176:3306/com.practice.jiojio?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=true&serverTimezone=GMT%2B8", "root", "com.practice.jiojio@123");

        PreparedStatement preparedStatement = connection.prepareStatement("select * from access_log");

        ResultSet resultSet = preparedStatement.executeQuery();

        while (resultSet.next()) {

            System.out.println(resultSet.getString("date"));

        }

        resultSet.close();
        preparedStatement.close();
        connection.close();


    }
}
